<div id="userbg">
<?php
if (! is_user_logged_in() ) {


?>
	
<form id="login_form" method="post" action="<?php bloginfo("siteurl");  ?>/action" method="post">	
		<div class="margin-top10">MEMBER LOGIN</div>
			<div class="margin-top25">
				<div class="left margin-right10">USER</div>
			<div class="left" style="background: url(<?php bloginfo('template_url'); ?>/img/userloginfield.jpg) no-repeat;
				 height: 21px; width: 119px;">
			<input type="text" name="username" id="user" style="background: none; border: none; width: 119px; color: #FFFFFF;" />
			</div>
			<div class="left margin-right10 margin-top5">PASS</div><div class="left margin-top5" 
				style="background: url(<?php bloginfo('template_url'); ?>/img/userloginfield.jpg) no-repeat;
				 height: 21px; width: 119px;">
				 <input type="password" name="password" id="pass" 
				 style="background: none; border: none; width: 119px; color: #FFFFFF;" />
			</div>
		<div class="clear">
		</div>
		<div class="margin-top10 margin-left40">
			<a href="javascript:void(0);" onclick="loginsubmit();" onmouseout="MM_swapImgRestore()" 
			onmouseover="MM_swapImage('login','','<?php bloginfo('template_url'); ?>/img/login_button_on.gif',1)">
			<img src="<?php bloginfo('template_url'); ?>/img/login_button.gif" alt="" 
			name="login" width="65" height="24" border="0" id="login" /></a></div>
			<div class="margin-top10 margin-left20 padding-left15"
		 style="background: url(<?php bloginfo('template_url'); ?>/img/arrow_yellow_icon.gif) no-repeat;">
		 <a href="<?php echo get_option("board_url"); ?>/register.php">REGISTER</a></div>
		<div class="margin-top5 margin-left20 padding-left15"
		 style="background: url(<?php bloginfo('template_url'); ?>/img/arrow_yellow_icon.gif) no-repeat;">
		 <a href="<?php echo get_option("board_url"); ?>/bb-login.php">FORGOT PASSWORD</a></div>
		
		<input type="hidden" name="action" value="login" />
		</div>
</form> 

<?php

	}else{
		$cuser =  wp_get_current_user();
?>
<form id="login_form" method="post" action="<?php bloginfo("siteurl");  ?>/action" method="post">	
  <div><?php echo $cuser->user_login; ?></div>
  <div><a onclick="loginsubmit()" href="javascript:return void(0);">ออกจากระบบ</a></div>
		<input type="hidden" name="action" value="logout" />
</form>
<?php }?>

	<script type="text/javascript">
	 function loginsubmit()
	 {
		$("#login_form").submit();
	}
	</script>
	
